package com.xuwang.controller;

import com.xuwang.Util.TableResult;
import com.xuwang.Util.WriteJson;
import com.xuwang.pojo.Restaurant;
import com.xuwang.service.RestaurantService;
import com.xuwang.service.RestaurantSupervisionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ Author  460503919
 * @ Date    2021/9/17 10:37
 * @ VERSION 1.0.0
 */
@Controller
@RequestMapping("/restaurantSupervision")
@Api(value = "(RestaurantSupervisionController)管理", tags = "(RestaurantSupervisionController)管理接口API")
@ApiResponses({
        @ApiResponse(code = 400, message = "请求参数不完整或者错误"),
        @ApiResponse(code = 302, message = "临时重定向，被拦截器栏了"),
        @ApiResponse(code = 304, message = "缓存数据"),
        @ApiResponse(code = 404, message = "找不到页面"),
        @ApiResponse(code = 405, message = "请求方式不正确，比如后台接收是post，但前端请求的是get"),
        @ApiResponse(code = 406, message = "页面地址和接口名冲突"),
        @ApiResponse(code = 415, message = "请求格式不正确，前端可能没有把请求头修改为json，也可能前端请求的json对象没有转换为字符串"),
        @ApiResponse(code = 500, message = "后台服务逻辑错误")
})
public class RestaurantSupervisionController {
    @Resource
    private RestaurantSupervisionService restaurantSupervisionService;

    /**
     * 查看餐馆原材料
     * @param id
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/showSupervision", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String showSupervision(Integer  id) throws Exception {
        TableResult<Restaurant> result;
        result = restaurantSupervisionService.showSupervision(id);
        return WriteJson.getJson(result);
    }

    /**
     * 查看餐馆原材料
     * @param id
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/showDisinfect", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String showDisinfect(Integer  id) throws Exception {
        TableResult<Restaurant> result;
        result = restaurantSupervisionService.showDisinfect(id);
        return WriteJson.getJson(result);
    }

}
